<template>
  <div class="popup">
    <form action="/">
      <van-search
        v-model="value"
        show-action
        placeholder="请输入搜索关键词"
        @search="onSearch"
        @cancel="onCancel"
      />
    </form>
  </div>
</template>
 
<script>
import { Toast } from 'vant';

export default {
  data() {
    return {
      value: "",
    };
  },
  methods: {
    onSearch(val) {
        console.log('按了回车');
      Toast(val);
    },
    onCancel() {
        console.log('取消');
        this.$router.go(-1);
      Toast('取消');
    },
  },
};
</script>
 
<style lang = "less" scoped>
.popup {
  width: 100%;
  height: 100%;
  position: absolute;
  right: 0;
  top: 0;
  background-color: rgba(0, 0, 0, 0.5);
}
</style>